<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Limb3 JS Tests</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <script src="../lib/prototype.js" type="text/javascript"></script>
  <script src="../lib/unittest.js" type="text/javascript"></script>

  <script src="../../shared/limb.js" type="text/javascript"></script>
  <link rel="stylesheet" href="../test.css" type="text/css" />
</head>
<body>
<h1>Limb test</h1>

<!-- Log output -->
<div id="testlog"> </div>

<!-- Tests follow -->
<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[

new Test.Unit.Runner({
  tearDown: function()
  {
    if(MyNamespace)
    {
      if(MyNamespace.MySubNamespace)
        MyNamespace.MySubNamespace = undefined;

      MyNamespace = undefined;
    }
  },

  testCreateNamespace: function()
  {
    Limb.namespace('MyNamespace');
    this.assert(typeof(MyNamespace) == 'object', 'Namespace not created');

    Limb.namespace('MyNamespace.MySubNamespace');
    this.assert(typeof(MyNamespace) == 'object', 'Namespace not created');
    this.assert(typeof(MyNamespace.MySubNamespace) == 'object', 'Subnamespace not created');
  },

  testDefineVariable: function()
  {
    Limb.define('myVar', 5);
    this.assertEqual(5, myVar, 'Vatiable not defined');

    Limb.namespace('MyNamespace');
    Limb.define('MyNamespace.myVar', 10);
    this.assertEqual(10, MyNamespace.myVar, 'Vatiable in namespace not defined');

    Limb.define('MyNamespace.MySubNamespace.myVar', 15);
    this.assertEqual(15, MyNamespace.MySubNamespace.myVar, 'Limb.define not created not existent namespace');
  }
});

// ]]>
</script>
</body>
</html>